package leetcode.linkedlist;

import leetcode.linkedlist.common.LinkedListUtils;
import leetcode.linkedlist.common.ListNode;

/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode() {}
 *     ListNode(int val) { this.val = val; }
 *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution2487 {
    public ListNode removeNodes(ListNode head) {
        return LinkedListUtils.removeNodes(head);
    }
}

public class leetcode2487 {
    public static void main(String[] args) {
        Solution2487 solution2487 = new Solution2487();
        int[] nums = {5,2,13,3,8};
        test2487(solution2487, nums);
    }

    private static void test2487(Solution2487 solution2487, int[] nums) {
        ListNode head = solution2487.removeNodes(LinkedListUtils.generateLinkedListByArray(nums));
        System.out.println(LinkedListUtils.getLinkedListVals(head));
    }
}
